package com.multitrack.main;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;

import com.multitrack.datatype.SocketMessage;

public class AgreeActivity extends Activity {

	static String TAG = "AgreeActivity";
	CheckBox checkBox;
	Button btn;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.agree_activity);
		checkBox = (CheckBox) findViewById(R.id.agree_check);
		btn = (Button) findViewById(R.id.agree_btn);
	}

	public void mOnClick(View v) {
		switch (v.getId()) {
		case R.id.agree_check:
			if (checkBox.isChecked())
				btn.setEnabled(true);
			else
				btn.setEnabled(false);
			break;

		case R.id.agree_btn:
			if (!(checkBox.isChecked()))
				break;

			Intent intent = new Intent(AgreeActivity.this, JoinActivity.class);
			intent.putExtra(SocketMessage.AGREE_SUCCESS.name(),
					checkBox.isChecked());
			startActivity(intent);
			finish();
			break;
		}
	}
}